﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.UI;
//上个项目copy过来的，没改名字。（此意义已丢失）
public class UIGuideChallenge : UIObject
{
    public Transform hand;
    public ScrollRect scrollRect;
    // Start is called before the first frame update
    protected override void onVisible()
    {
        base.onVisible();
        Challenge();
    }

    Sequence _sequence;
    protected override void OnInvisible()
    {
        base.OnInvisible();
        _sequence.Kill();
    }


    private void Challenge()
    {
        this.transform.localPosition = new Vector3(0, -500, 0);

        Sequence s = DOTween.Sequence(this.gameObject);
        s.AppendInterval(8);
        s.Append(this.transform.DOLocalMove(Vector3.zero, 1));
        //手指滚动
        //s.Append(this.hand.DOLocalMove(new Vector3(-84, -43, 0), 0.1f));
        //s.Append(this.hand.DOLocalMove(new Vector3(-84, 35, 0), 1f));
        //手指按下
        //s.Append(this.hand.DOLocalMove(new Vector3(80, -17, 0), 1f));
        s.Append(hand.DOLocalRotate(new Vector3(0, 0, -30), 0.1f));
        s.Append(hand.DOLocalRotate(new Vector3(0, 0, 10), 1));
        //移除屏幕外
        s.AppendInterval(1);
        s.Append(this.transform.DOLocalMove(new Vector3(0, -500, 0), 1));
        //设置次数
        //s.SetLoops(4, LoopType.Yoyo);
        _sequence = s;

    }

}
